//
//  BaseTabbar.m
//  ZJControlsClass
//
//  Created by apple on 2024/10/22.
//

#import "BaseTabbar.h"

@implementation BaseTabbar

-(void)layoutSubviews{
    [super layoutSubviews];
    
    self.backgroundColor = [UIColor whiteColor];
    
    for (UIControl * tabBarButton in self.subviews) {
        if ([tabBarButton isKindOfClass:NSClassFromString(@"UITabBarButton")]) {
            [tabBarButton addTarget:self action:@selector(tabBarButtonClick:) forControlEvents:UIControlEventTouchUpInside];
        }
        
    }
    
}

// item的点击动画
-(void)tabBarButtonClick:(UIControl *)tabBarButton{
    for (UIView *imageView in tabBarButton.subviews) {
        if ([imageView isKindOfClass:NSClassFromString(@"UITabBarSwappableImageView")]) {
            // 需要实现的帧动画
            CAKeyframeAnimation *animation = [CAKeyframeAnimation animation];
            animation.keyPath = @"transform.scale";
            animation.values = @[@1.0,@1.3,@0.9,@1.15,@0.95,@1.02,@1.0];
            animation.duration = 1;
            animation.calculationMode = kCAAnimationCubic;
            // 添加动画
            [imageView.layer addAnimation:animation forKey:nil];
            
        }
        
    }
    
    
    
}






@end

